<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        /* .dd{
          margin-left: 50%;
        } */
        .dd{
            width: 260px;
            margin: 0 auto;
        }
        .box{
            width: 200px;
            height: 200px;
            background-color: black;
           /* margin-left: 30px; */
           margin: 0 auto;
        }
    </style>
</head>
<body>
    <div class="dd">
         <button class="btn1">变宽</button>
    <button class="btn2">变高</button>
    <button class="btn3">变色</button>
    <button class="btn4">隐藏</button>
    <button class="btn5">恢复</button> 
</div>
    <div class="box"></div>
   
   
    <script>
      var btn1 = document.querySelector('.btn1');
      var btn2 = document.querySelector('.btn2');
      var btn3 = document.querySelector('.btn3');
      var btn4 = document.querySelector('.btn4');
      var btn5 = document.querySelector('.btn5');
      var box = document.querySelector('.box');

        btn1.onclick = function(){
            box.style.width='500px';
        }
        btn2.onclick = function(){
            box.style.height='500px';
        }
        btn3.onclick = function(){
            box.style.backgroundColor='red';
        }
        btn4.onclick = function(){
            box.style.display='none';
        }
        btn5.onclick = function(){
            box.style.width='200px';
            box.style.height='200px';
            box.style.backgroundColor='black';
            box.style.display='block';
        }
    </script>
</body>
</html>